﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DaiChong.Lib.Http;
using System.Text.RegularExpressions;
using WTest.Model;
using System.Threading;
using System.Web;
using System.IO;
using System.Runtime.InteropServices;

namespace WTest
{
    public partial class Form2 : Form
    {
        private string sitename = "";
        public Form2()
        {
            InitializeComponent();
        }

        #region Letv
        private void btnLetv_Click(object sender, EventArgs e)
        {
            sitename = txtSite.Text.Trim();
            msgLetv.Text = "start";
            AsyncLetv asyncLetv = new AsyncLetv();
            asyncLetv.SiteName = sitename;
            asyncLetv.SetTarget = this;
            asyncLetv.StartAsync();

            asyncLetv.Complete += new CompleteHandler(asyncLetv_Complete);
            asyncLetv.Message += new MessageHandler(asyncLetv_Message);
        }

        void asyncLetv_Message(object sender, string message)
        {
            msgLetv.AppendText(message);
        }

        void asyncLetv_Complete(object sender)
        {
            msgLetv.AppendText(Environment.NewLine + "Letv:ok");
        }
        #endregion

        #region Qiyi
        private void btnQiyi_Click(object sender, EventArgs e)
        {
            sitename = txtSite.Text.Trim();
            msgQiyi.Text = "start";
            AsyncQiyi asyncQiyi = new AsyncQiyi();
            asyncQiyi.SiteName = sitename;
            asyncQiyi.SetTarget = this;
            asyncQiyi.StartAsync();

            asyncQiyi.Complete += new CompleteHandler(asyncQiyi_Complete);
            asyncQiyi.Message += new MessageHandler(asyncQiyi_Message);
        }

        void asyncQiyi_Message(object sender, string message)
        {
            msgQiyi.AppendText(message);
        }

        void asyncQiyi_Complete(object sender)
        {
            msgQiyi.AppendText(Environment.NewLine + "Qiyi:ok");
        }
        #endregion

        #region Baidu
        private void btnBaidu_Click(object sender, EventArgs e)
        {
            sitename = txtSite.Text.Trim();
            AsyncBaidu asyncBaidu = new AsyncBaidu();
            asyncBaidu.SiteName = sitename;
            asyncBaidu.SetTarget = this;
            asyncBaidu.Complete += new CompleteHandler(asyncBaidu_Complete);
            asyncBaidu.StartAsync();
        }

        void asyncBaidu_Complete(object sender)
        {
            msgLetv.AppendText(Environment.NewLine + "Baidu:ok");
        }
        #endregion

        private void button1_Click(object sender, EventArgs e)
        {
            //
        }

    }
}
